<?php

session_start();

if (!isset($_SESSION['token'])) {
    //uuqid不能使用
    $_SESSION['token'] = sha1(bin2hex(random_bytes(16)));
}

include_once '../sys/config/db-cred.inc.php';


foreach ($C as $name => $val) {
    define($name, $val);
}

$dsn = 'mysql:host=' . DB_HOST . ";dbname=" . DB_NAME;
$dbo = new PDO($dsn, DB_USER, DB_PASS);

function autoload($class)
{
    $filename = '../sys/class/class.' . $class . '.inc.php';
    if (file_exists($filename)) {
        include_once $filename;
    }
}

spl_autoload_register('autoload');